package com.atguigu.gulimall.product.entity;

import com.atguigu.common.valid.ListValue;
import com.atguigu.common.valid.addGroup;
import com.atguigu.common.valid.updateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author xjx
 * @email xiajinxiang163@163.com
 * @date 2021-04-11 14:20:25
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @NotNull(groups = updateGroup.class)
    @Null(groups = addGroup.class)
    @TableId
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(message = "品牌名称不能为空", groups = addGroup.class)
    private String name;
    /**
     * 品牌logo地址
     */
    @NotNull(groups = addGroup.class)
    @URL(message = "logo的地址必须为一个合法的url地址", groups = {updateGroup.class, addGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    //@TableLogic(value = "1",delval = "0")
    @ListValue(values = {1, 2},groups = addGroup.class)
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(groups = addGroup.class)
    @Pattern(regexp = "^[a-zA-Z]$", message = "首字母必须为a-z或A-Z", groups = {addGroup.class, updateGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(groups = addGroup.class)
    @Min(value = 0, message = "排序数字最小为0", groups = {addGroup.class, updateGroup.class})
    private Integer sort;

}
